<script>
	export default {
		onLaunch: function() {
			this.userinfo()
			if (options.share) {
				// 通过分享链接进入小程序，进行页面跳转
				uni.navigateTo({
					url: '/pages/index/index'
				})
			}
			console.log('App Launch')
		},
		onShow: function() {
			let menuButtonObject = wx.getMenuButtonBoundingClientRect()
			// 获取设备信息
			wx.getSystemInfo({
				success: res => {
					console.log(res, '1020202');
					// if (res.locationEnabled) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '需要开启定位权限才能获取当前位置，请前往设置中心开启。',
					// 		confirmText: '我已开启',
					// 		showCancel: false,
					// 		success: (res)=> {
					// 		}
					// 	});
					// }
					let navHeight = menuButtonObject.top + menuButtonObject.height + (menuButtonObject
						.top - res.statusBarHeight) * 2

					uni.setStorageSync('ht', navHeight)
				},
				fail: err => {
					console.log(err)
				}
			})
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			async userinfo() {
				let n = await this.$api.banner()
				// 存储起始数据
				uni.setStorageSync('initData', n.data)
				let m = await this.$api.Profile()
				uni.setStorageSync('userinfo', m.data)
			}
		}
	}
</script>

<style>
	@import '@/setting.css';
</style>
<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";

	page {
		background-color: #f9f9f9;
	}
</style>